home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4212 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP!! BAMBOOZLED BEGINNER!!
  5. Date: 02 Feb 1996 18:45:43 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb2114543@qcd.lanl.gov>
  8. References: <Pine.OSF.3.91l.960130235948.20497A-100000@saul3.u.washington.edu>
  9.     <4eru59$s8t@gryphon.phoenix.net>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: brucew@phoenix.net's message of Fri, 02 Feb 1996 03:28:31 GMT
  14.  
  15. In article <4eru59$s8t@gryphon.phoenix.net> brucew@phoenix.net (Bruce
  16. Wedding) writes: 
  17. <snip>
  18.    Since you aren't accepting negative values for the exponent, make
  19.    this:
  20.    unsigned long int i, i_total;  
  21.    That will give the largest range without resorting to floating
  22.    point.
  23.  
  24.    >   scanf("%d", &i); 
  25.  
  26.    change this to scanf("%U", &i);
  27.  
  28. What is %U? Did you mean %lu?
  29.  
  30. <snip>
  31.    Here is a tested version.  There is still no overflow protection.
  32. <snip>
  33.     scanned = scanf("%U*%c", &power);
  34.  
  35. This leads to undefined behaviour. Did you mean %*c by any chance?
  36.  
  37. Cheers
  38. Tanmoy
  39. --
  40. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  41. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  42. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  43. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  44. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  45. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  46.